<include file="Public/head"/>
<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="row">
                            <form class="form-inline" action="" method="get">
                                <label class="inline">商家名称：</label>
                                <input type="text" name="keyword" value="{:I(keyword)}" class="form-control">
                                <button type="submit" class="btn btn-purple btn-sm">
                                    <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                                    Search
                                </button>
                            </form>
                        </div>
                        <div class="space-4"></div>
                        <div class="row">
                            <form id="form" method="post" action="{:U('del')}">
                                <table class="table table-striped table-bordered table-hover" id="simple-table">
                                    <thead>
                                    <tr>
                                        <th>商户ID</th>
                                        <th>商户名称</th>
                                        <th>联系人</th>
                                        <th>联系电话</th>
                                        <th>联系地址</th>
                                        <th class="center">授权时间</th>
                                        <th class="center">审核状态</th>
                                        <th class="center">创建时间</th>
                                        <th class="center">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <volist name="lists" id="val">
                                        <tr>
                                            <td>{$val['id']}</td>
                                            <td>{$val.shop_name}</td>
                                            <td>{$val['contact']}</td>
											<td>{$val['contact_tel']}</td>
                                            <td>{$val.address}</td>
                                            <td class="center">{:date('Y-m-d',$val['auth_time'])}</td>
                                            <td class="center">
												<input name="islink" id="islink" data-id="{$val.id}" <eq name="val.status" value="1">checked</eq> value="<eq name="val.status" value="1">0<else/>1</eq>" class="ace ace-switch ace-switch-2" type="checkbox" />
												<span class="lbl"></span>
											</td>
                                            <td class="center">{:date('Y-m-d',$val['create_time'])}</td>
                                            <td class="center">
												<a href="{:U('Customer/Update',array('id' => $val['id']))}">修改</a> | 
												<a href="{:U('Customer/Delete',array('id' => $val['id']))}" menu="tips_menu" title="是否要删除这个商家？">删除</a>
											</td>
                                        </tr>
                                    </volist>
                                    </tbody>
                                </table>
                            </form>
                        </div>
						{$page}
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <include file="Public/footer"/>

</div><!-- /.main-container -->

<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script type="text/javascript">
    $(function () {
        $('[menu="tips_menu"]').click(function () {
            var _self = $(this);
            bootbox.confirm({
                title: "系统提示",
                message: _self.attr('title'),
                callback: function (result) {
                    if (result) {
                        window.location.href = _self.attr('href');
                    }
                },
                buttons: {
                    "cancel": {"label": "取消"},
                    "confirm": {
                        "label": "确定",
                        "className": "btn-danger"
                    }
                }
            });
			return false;
        });
    });
	$('input#islink').on('click', function(e) {
		$.get('{:U('Customer/saveStatus')}' , { id:$(this).attr('data-id'),status:$(this).val() });
		$(this).val($(this).val()==0?1:0);
	});

</script>
</body>
</html>
